package com.aaa.config;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CharacterEncodingFilter;

import javax.servlet.Filter;

/**
 * -*- coding:utf-8 -*-
 *
 * @author 太阳偷渡青山
 * @software IntelliJ IDEA
 * @date 2022/11/16 9:44
 * @Description
 */
@Configuration
public class EncodingFilterConfig {
    @Bean
    public FilterRegistrationBean<Filter> filterFilterRegistrationBean() {
        FilterRegistrationBean<Filter> filterRegistrationBean = new FilterRegistrationBean<>();
        filterRegistrationBean.setName("encodingFilter");
        filterRegistrationBean.addUrlPatterns("/*");
        filterRegistrationBean.setFilter(new CharacterEncodingFilter());
        return filterRegistrationBean;
    }
}
